package edu.zut.bailan.cart.service.impl;

import edu.zut.bailan.base.service.impl.GenericTreeManagerImpl;
import edu.zut.bailan.cart.dao.CartGroupDao;
import edu.zut.bailan.cart.domain.CartGroup;
import edu.zut.bailan.cart.service.CartGroupManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


import java.util.ArrayList;
import java.util.List;

@Service(value = "cartGroupManager")
@Transactional
public class CartGroupManagerImpl extends GenericTreeManagerImpl<CartGroup, Long>
        implements CartGroupManager {

    CartGroupDao cartGroupDao;

    @Autowired
    public void setCartGroupDao(CartGroupDao cartGroupDao) {
        this.cartGroupDao = cartGroupDao;
        this.treeDao = this.cartGroupDao;
        this.dao = this.treeDao;
    }

    @Override
    public List list() {
        List list = new ArrayList();
        for (int i = 0; i < 100; i++) {
            CartGroup c = new CartGroup();
            c.setCode("cart_grou_"+i);
            c.setPrice(i);
            c.setEntityName("edu.zut.ai.mind");
            list.add(c);
        }
        return list;
    }

}
